diff --git a/javascript/extractor/src/com/semmle/js/ast/DefaultVisitor.java b/javascript/extractor/src/com/semmle/js/ast/DefaultVisitor.java index e6c6110fd36..d6779fdaa3b 100644 --- a/javascript/extractor/src/com/semmle/js/ast/DefaultVisitor.java +++ b/javascript/extractor/src/com/semmle/js/ast/DefaultVisitor.java @@ -35,7 +35,6 @@ import com.semmle.ts.ast.InterfaceDeclaration; import com.semmle.ts.ast.InterfaceTypeExpr; import com.semmle.ts.ast.IntersectionTypeExpr; import com.semmle.ts.ast.IsTypeExpr; -import com.semmle.ts.ast.UnaryTypeExpr; import com.semmle.ts.ast.KeywordTypeExpr; import com.semmle.ts.ast.MappedTypeExpr; import com.semmle.ts.ast.NamespaceDeclaration; @@ -49,6 +48,7 @@ import com.semmle.ts.ast.TypeAssertion; import com.semmle.ts.ast.TypeExpression; import com.semmle.ts.ast.TypeParameter; import com.semmle.ts.ast.TypeofTypeExpr; +import com.semmle.ts.ast.UnaryTypeExpr; import com.semmle.ts.ast.UnionTypeExpr; import com.semmle.util.exception.CatastrophicError; diff --git a/javascript/extractor/src/com/semmle/js/ast/Visitor.java b/javascript/extractor/src/com/semmle/js/ast/Visitor.java index a1ab0101208..f825d448719 100644 --- a/javascript/extractor/src/com/semmle/js/ast/Visitor.java +++ b/javascript/extractor/src/com/semmle/js/ast/Visitor.java @@ -31,7 +31,6 @@ import com.semmle.ts.ast.InterfaceDeclaration; import com.semmle.ts.ast.InterfaceTypeExpr; import com.semmle.ts.ast.IntersectionTypeExpr; import com.semmle.ts.ast.IsTypeExpr; -import com.semmle.ts.ast.UnaryTypeExpr; import com.semmle.ts.ast.KeywordTypeExpr; import com.semmle.ts.ast.MappedTypeExpr; import com.semmle.ts.ast.NamespaceDeclaration; @@ -44,6 +43,7 @@ import com.semmle.ts.ast.TypeAliasDeclaration; import com.semmle.ts.ast.TypeAssertion; import com.semmle.ts.ast.TypeParameter; import com.semmle.ts.ast.TypeofTypeExpr; +import com.semmle.ts.ast.UnaryTypeExpr; import com.semmle.ts.ast.UnionTypeExpr; /** diff --git a/javascript/extractor/src/com/semmle/js/extractor/ASTExtractor.java b/javascript/extractor/src/com/semmle/js/extractor/ASTExtractor.java index 64bad10273d..cc867bc9d68 100644 --- a/javascript/extractor/src/com/semmle/js/extractor/ASTExtractor.java +++ b/javascript/extractor/src/com/semmle/js/extractor/ASTExtractor.java @@ -1,11 +1,5 @@ package com.semmle.js.extractor; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Set; -import java.util.Stack; - import com.semmle.js.ast.AClass; import com.semmle.js.ast.AFunction; import com.semmle.js.ast.AFunctionExpression; @@ -149,6 +143,11 @@ import com.semmle.ts.ast.UnionTypeExpr; import com.semmle.util.collections.CollectionUtil; import com.semmle.util.trap.TrapWriter; import com.semmle.util.trap.TrapWriter.Label; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Set; +import java.util.Stack; /** Extractor for AST-based information; invoked by the {@link JSExtractor}. */ public class ASTExtractor { diff --git a/javascript/extractor/src/com/semmle/js/extractor/AutoBuild.java b/javascript/extractor/src/com/semmle/js/extractor/AutoBuild.java index 0544290ebd6..5ffa5680cd9 100644 --- a/javascript/extractor/src/com/semmle/js/extractor/AutoBuild.java +++ b/javascript/extractor/src/com/semmle/js/extractor/AutoBuild.java @@ -1,5 +1,26 @@ package com.semmle.js.extractor; +import com.semmle.js.extractor.ExtractorConfig.SourceType; +import com.semmle.js.extractor.FileExtractor.FileType; +import com.semmle.js.extractor.trapcache.DefaultTrapCache; +import com.semmle.js.extractor.trapcache.DummyTrapCache; +import com.semmle.js.extractor.trapcache.ITrapCache; +import com.semmle.js.parser.ParsedProject; +import com.semmle.js.parser.TypeScriptParser; +import com.semmle.ts.extractor.TypeExtractor; +import com.semmle.ts.extractor.TypeTable; +import com.semmle.util.data.StringUtil; +import com.semmle.util.exception.CatastrophicError; +import com.semmle.util.exception.Exceptions; +import com.semmle.util.exception.ResourceError; +import com.semmle.util.exception.UserError; +import com.semmle.util.extraction.ExtractorOutputConfig; +import com.semmle.util.files.FileUtil; +import com.semmle.util.io.csv.CSVReader; +import com.semmle.util.language.LegacyLanguage; +import com.semmle.util.process.Env; +import com.semmle.util.projectstructure.ProjectLayout; +import com.semmle.util.trap.TrapWriter; import java.io.File; import java.io.IOException; import java.io.Reader; @@ -27,28 +48,6 @@ import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import java.util.stream.Stream; -import com.semmle.js.extractor.ExtractorConfig.SourceType; -import com.semmle.js.extractor.FileExtractor.FileType; -import com.semmle.js.extractor.trapcache.DefaultTrapCache; -import com.semmle.js.extractor.trapcache.DummyTrapCache; -import com.semmle.js.extractor.trapcache.ITrapCache; -import com.semmle.js.parser.ParsedProject; -import com.semmle.js.parser.TypeScriptParser; -import com.semmle.ts.extractor.TypeExtractor; -import com.semmle.ts.extractor.TypeTable; -import com.semmle.util.data.StringUtil; -import com.semmle.util.exception.CatastrophicError; -import com.semmle.util.exception.Exceptions; -import com.semmle.util.exception.ResourceError; -import com.semmle.util.exception.UserError; -import com.semmle.util.extraction.ExtractorOutputConfig; -import com.semmle.util.files.FileUtil; -import com.semmle.util.io.csv.CSVReader; -import com.semmle.util.language.LegacyLanguage; -import com.semmle.util.process.Env; -import com.semmle.util.projectstructure.ProjectLayout; -import com.semmle.util.trap.TrapWriter; - /** * An alternative entry point to the JavaScript extractor. * @@ -71,8 +70,8 @@ import com.semmle.util.trap.TrapWriter; * patterns that can be used to refine the list of files to include and exclude *
  • LGTM_INDEX_TYPESCRIPT: whether to extract TypeScript *
  • LGTM_INDEX_FILETYPES: a newline-separated list of ".extension:filetype" pairs - * specifying which {@link FileType} to use for the given extension; the additional file - * type XML is also supported + * specifying which {@link FileType} to use for the given extension; the additional file type + * XML is also supported *
  • LGTM_INDEX_XML_MODE: whether to extract XML files *
  • LGTM_THREADS: the maximum number of files to extract in parallel *
  • LGTM_TRAP_CACHE: the path of a directory to use for trap caching @@ -166,8 +165,8 @@ import com.semmle.util.trap.TrapWriter; *

    If LGTM_INDEX_XML_MODE is set to ALL, then all files with extension * .xml under LGTM_SRC are extracted as XML (in addition to any files * whose file type is specified to be XML via LGTM_INDEX_SOURCE_TYPE). - * Currently XML extraction does not respect inclusion and exclusion filters, but this is a bug, - * not a feature, and hence will change eventually. + * Currently XML extraction does not respect inclusion and exclusion filters, but this is a bug, not + * a feature, and hence will change eventually. * *

    Note that all these customisations only apply to LGTM_SRC. Extraction of externs * is not customisable. @@ -288,8 +287,7 @@ public class AutoBuild { try { fileType = StringUtil.uc(fileType); if ("XML".equals(fileType)) { - if (extension.length() < 2) - throw new UserError("Invalid extension '" + extension + "'."); + if (extension.length() < 2) throw new UserError("Invalid extension '" + extension + "'."); xmlExtensions.add(extension.substring(1)); } else { fileTypes.put(extension, FileType.valueOf(fileType)); @@ -304,8 +302,7 @@ public class AutoBuild { private void setupXmlMode() { String xmlMode = getEnvVar("LGTM_INDEX_XML_MODE", "DISABLED"); xmlMode = StringUtil.uc(xmlMode.trim()); - if ("ALL".equals(xmlMode)) - xmlExtensions.add("xml"); + if ("ALL".equals(xmlMode)) xmlExtensions.add("xml"); else if (!"DISABLED".equals(xmlMode)) throw new UserError("Invalid XML mode '" + xmlMode + "' (should be either ALL or DISABLED)."); } @@ -744,8 +741,7 @@ public class AutoBuild { try { long start = logBeginProcess("Extracting " + file); Integer loc = extractor.extract(f, state); - if (!extractor.getConfig().isExterns() && (loc == null || loc != 0)) - seenCode = true; + if (!extractor.getConfig().isExterns() && (loc == null || loc != 0)) seenCode = true; logEndProcess(start, "Done extracting " + file); } catch (Throwable t) { System.err.println("Exception while extracting " + file + "."); @@ -776,8 +772,7 @@ public class AutoBuild { } protected void extractXml() throws IOException { - if (xmlExtensions.isEmpty()) - return; + if (xmlExtensions.isEmpty()) return; List cmd = new ArrayList<>(); cmd.add("odasa"); cmd.add("index"); diff --git a/javascript/extractor/src/com/semmle/js/extractor/FileExtractor.java b/javascript/extractor/src/com/semmle/js/extractor/FileExtractor.java index f70454c8daa..3af6fe612a2 100644 --- a/javascript/extractor/src/com/semmle/js/extractor/FileExtractor.java +++ b/javascript/extractor/src/com/semmle/js/extractor/FileExtractor.java @@ -384,9 +384,7 @@ public class FileExtractor { return config.hasFileType() || FileType.forFile(f, config) != null; } - /** - * @return the number of lines of code extracted, or {@code null} if the file was cached - */ + /** @return the number of lines of code extracted, or {@code null} if the file was cached */ public Integer extract(File f, ExtractorState state) throws IOException { // populate source archive String source = new WholeIO(config.getDefaultEncoding()).strictread(f); diff --git a/javascript/extractor/src/com/semmle/js/extractor/TypeExprKinds.java b/javascript/extractor/src/com/semmle/js/extractor/TypeExprKinds.java index 7001f9540b4..78b901da475 100644 --- a/javascript/extractor/src/com/semmle/js/extractor/TypeExprKinds.java +++ b/javascript/extractor/src/com/semmle/js/extractor/TypeExprKinds.java @@ -17,7 +17,6 @@ import com.semmle.ts.ast.InferTypeExpr; import com.semmle.ts.ast.InterfaceTypeExpr; import com.semmle.ts.ast.IntersectionTypeExpr; import com.semmle.ts.ast.IsTypeExpr; -import com.semmle.ts.ast.UnaryTypeExpr; import com.semmle.ts.ast.KeywordTypeExpr; import com.semmle.ts.ast.MappedTypeExpr; import com.semmle.ts.ast.OptionalTypeExpr; @@ -26,6 +25,7 @@ import com.semmle.ts.ast.RestTypeExpr; import com.semmle.ts.ast.TupleTypeExpr; import com.semmle.ts.ast.TypeParameter; import com.semmle.ts.ast.TypeofTypeExpr; +import com.semmle.ts.ast.UnaryTypeExpr; import com.semmle.ts.ast.UnionTypeExpr; import com.semmle.util.exception.CatastrophicError; @@ -129,8 +129,10 @@ public class TypeExprKinds { @Override public Integer visit(UnaryTypeExpr nd, Void c) { switch (nd.getKind()) { - case Keyof: return keyofTypeExpr; - case Readonly: return readonlyTypeExpr; + case Keyof: + return keyofTypeExpr; + case Readonly: + return readonlyTypeExpr; } throw new CatastrophicError("Unhandled UnaryTypeExpr kind: " + nd.getKind()); } diff --git a/javascript/extractor/src/com/semmle/js/extractor/test/AutoBuildTests.java b/javascript/extractor/src/com/semmle/js/extractor/test/AutoBuildTests.java index ea79971aedc..0d45908885b 100644 --- a/javascript/extractor/src/com/semmle/js/extractor/test/AutoBuildTests.java +++ b/javascript/extractor/src/com/semmle/js/extractor/test/AutoBuildTests.java @@ -1,5 +1,14 @@ package com.semmle.js.extractor.test; +import com.semmle.js.extractor.AutoBuild; +import com.semmle.js.extractor.ExtractorState; +import com.semmle.js.extractor.FileExtractor; +import com.semmle.js.extractor.FileExtractor.FileType; +import com.semmle.util.data.StringUtil; +import com.semmle.util.exception.UserError; +import com.semmle.util.files.FileUtil; +import com.semmle.util.files.FileUtil8; +import com.semmle.util.process.Env; import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; @@ -16,23 +25,12 @@ import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Set; - import org.junit.After; import org.junit.Assert; import org.junit.Assume; import org.junit.Before; import org.junit.Test; -import com.semmle.js.extractor.AutoBuild; -import com.semmle.js.extractor.ExtractorState; -import com.semmle.js.extractor.FileExtractor; -import com.semmle.js.extractor.FileExtractor.FileType; -import com.semmle.util.data.StringUtil; -import com.semmle.util.exception.UserError; -import com.semmle.util.files.FileUtil; -import com.semmle.util.files.FileUtil8; -import com.semmle.util.process.Env; - public class AutoBuildTests { private Path SEMMLE_DIST, LGTM_SRC; private Set expected; @@ -132,16 +130,18 @@ public class AutoBuildTests { @Override protected void extractXml() throws IOException { - Files.walkFileTree(LGTM_SRC, new SimpleFileVisitor(){ - @Override - public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) - throws IOException { - String ext = FileUtil.extension(file); - if (!ext.isEmpty() && getXmlExtensions().contains(ext.substring(1))) - actual.add(file.toString()); - return FileVisitResult.CONTINUE; - } - }); + Files.walkFileTree( + LGTM_SRC, + new SimpleFileVisitor() { + @Override + public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) + throws IOException { + String ext = FileUtil.extension(file); + if (!ext.isEmpty() && getXmlExtensions().contains(ext.substring(1))) + actual.add(file.toString()); + return FileVisitResult.CONTINUE; + } + }); } }.run(); String expectedString = StringUtil.glue("\n", expected.stream().sorted().toArray()); diff --git a/javascript/extractor/src/com/semmle/js/parser/JSDocParser.java b/javascript/extractor/src/com/semmle/js/parser/JSDocParser.java index c20c31b5b00..391f703d2b0 100644 --- a/javascript/extractor/src/com/semmle/js/parser/JSDocParser.java +++ b/javascript/extractor/src/com/semmle/js/parser/JSDocParser.java @@ -47,9 +47,8 @@ public class JSDocParser { // This occurs before the start of 'source', so the lineStart is negative. int firstLineStart = -(startPos.getColumn() + "/**".length() - 1); this.absoluteOffset = startPos.getOffset(); - Pair> r = p.new TagParser(null).parseComment( - startPos.getLine() - 1, - firstLineStart); + Pair> r = + p.new TagParser(null).parseComment(startPos.getLine() - 1, firstLineStart); List tags = new ArrayList<>(); for (JSDocTagParser.Tag tag : r.snd()) { String title = tag.title; @@ -269,21 +268,21 @@ public class JSDocParser { return new SourceLocation(pos()); } - /** - * Returns the absolute position of the start of the current token. - */ + /** Returns the absolute position of the start of the current token. */ private Position pos() { - return new Position(this.lineNumber + 1, startOfCurToken - lineStart, startOfCurToken + absoluteOffset); + return new Position( + this.lineNumber + 1, startOfCurToken - lineStart, startOfCurToken + absoluteOffset); } /** * Returns the absolute position of the end of the previous token. * - * This can differ from the start of the current token in case the two tokens - * are separated by whitespace. + *

    This can differ from the start of the current token in case the two tokens are separated + * by whitespace. */ private Position endPos() { - return new Position(this.lineNumber + 1, endOfPrevToken - lineStart, endOfPrevToken + absoluteOffset); + return new Position( + this.lineNumber + 1, endOfPrevToken - lineStart, endOfPrevToken + absoluteOffset); } private T finishNode(T node) { @@ -306,7 +305,8 @@ public class JSDocParser { if (index >= source.length()) return -1; int ch = source.charAt(index); ++index; - if (isLineTerminator(ch) && !(ch == '\r' && index < endIndex && source.charAt(index) == '\n')) { + if (isLineTerminator(ch) + && !(ch == '\r' && index < endIndex && source.charAt(index) == '\n')) { lineNumber += 1; lineStart = index; index = skipStars(index, endIndex); @@ -950,7 +950,10 @@ public class JSDocParser { consume(Token.COLON); expr = finishNode( - new ParameterType(new SourceLocation(loc), ((NameExpression) expr).getName(), parseTypeExpression())); + new ParameterType( + new SourceLocation(loc), + ((NameExpression) expr).getName(), + parseTypeExpression())); } if (token == Token.EQUAL) { consume(Token.EQUAL); @@ -1125,8 +1128,7 @@ public class JSDocParser { consume(Token.RBRACK, "expected an array-style type declaration (' + value + '[])"); List expressions = new ArrayList<>(); expressions.add(expr); - NameExpression nameExpr = - finishNode(new NameExpression(new SourceLocation(loc), "Array")); + NameExpression nameExpr = finishNode(new NameExpression(new SourceLocation(loc), "Array")); return finishNode(new TypeApplication(loc, nameExpr, expressions)); } @@ -1183,7 +1185,8 @@ public class JSDocParser { return expr; } - private JSDocTypeExpression parseType(int startIndex, int endIndex, int lineStart, int lineNumber) throws ParseError { + private JSDocTypeExpression parseType( + int startIndex, int endIndex, int lineStart, int lineNumber) throws ParseError { JSDocTypeExpression expr; this.lineNumber = lineNumber; @@ -1202,7 +1205,8 @@ public class JSDocParser { return expr; } - private JSDocTypeExpression parseParamType(int startIndex, int endIndex, int lineStart, int lineNumber) throws ParseError { + private JSDocTypeExpression parseParamType( + int startIndex, int endIndex, int lineStart, int lineNumber) throws ParseError { JSDocTypeExpression expr; this.lineNumber = lineNumber; diff --git a/javascript/extractor/src/com/semmle/js/parser/TypeScriptASTConverter.java b/javascript/extractor/src/com/semmle/js/parser/TypeScriptASTConverter.java index 9a996627eae..dc36d57bf30 100644 --- a/javascript/extractor/src/com/semmle/js/parser/TypeScriptASTConverter.java +++ b/javascript/extractor/src/com/semmle/js/parser/TypeScriptASTConverter.java @@ -1,13 +1,5 @@ package com.semmle.js.parser; -import java.util.ArrayList; -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonNull; @@ -149,6 +141,13 @@ import com.semmle.ts.ast.TypeofTypeExpr; import com.semmle.ts.ast.UnaryTypeExpr; import com.semmle.ts.ast.UnionTypeExpr; import com.semmle.util.collections.CollectionUtil; +import java.util.ArrayList; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; /** * Utility class for converting a The Node.js half of the wrapper is expected to live at {@code * $SEMMLE_DIST/tools/typescript-parser-wrapper/main.js}; non-standard locations can be configured * using the property {@value #PARSER_WRAPPER_PATH_ENV_VAR}. - * - *

    The script launches the Node.js wrapper in the Node.js runtime, looking for {@code node} - * on the {@code PATH} by default. Non-standard locations can be configured using the property - * {@value #TYPESCRIPT_NODE_RUNTIME_VAR}, and additional arguments can be configured using the - * property {@value #TYPESCRIPT_NODE_RUNTIME_EXTRA_ARGS_VAR}. + * + *

    The script launches the Node.js wrapper in the Node.js runtime, looking for {@code node} on + * the {@code PATH} by default. Non-standard locations can be configured using the property {@value + * #TYPESCRIPT_NODE_RUNTIME_VAR}, and additional arguments can be configured using the property + * {@value #TYPESCRIPT_NODE_RUNTIME_EXTRA_ARGS_VAR}. * *

    The script is started upon parsing the first TypeScript file and then is kept running in the * background, passing it requests for parsing files and getting JSON-encoded ASTs as responses. @@ -62,8 +60,8 @@ public class TypeScriptParser { public static final String PARSER_WRAPPER_PATH_ENV_VAR = "SEMMLE_TYPESCRIPT_PARSER_WRAPPER"; /** - * An environment variable that can be set to indicate the location of the Node.js runtime, - * as an alternative to adding Node to the PATH. + * An environment variable that can be set to indicate the location of the Node.js runtime, as an + * alternative to adding Node to the PATH. */ public static final String TYPESCRIPT_NODE_RUNTIME_VAR = "SEMMLE_TYPESCRIPT_NODE_RUNTIME"; @@ -71,7 +69,8 @@ public class TypeScriptParser { * An environment variable that can be set to provide additional arguments to the Node.js runtime * each time it is invoked. Arguments should be separated by spaces. */ - public static final String TYPESCRIPT_NODE_RUNTIME_EXTRA_ARGS_VAR = "SEMMLE_TYPESCRIPT_NODE_RUNTIME_EXTRA_ARGS"; + public static final String TYPESCRIPT_NODE_RUNTIME_EXTRA_ARGS_VAR = + "SEMMLE_TYPESCRIPT_NODE_RUNTIME_EXTRA_ARGS"; /** * An environment variable that can be set to specify a timeout to use when verifying the @@ -102,8 +101,8 @@ public class TypeScriptParser { /** * An environment variable with additional VM arguments to pass to the Node process. - *

    - * Only --inspect or --inspect-brk may be used at the moment. + * + *

    Only --inspect or --inspect-brk may be used at the moment. */ public static final String TYPESCRIPT_NODE_FLAGS = "SEMMLE_TYPESCRIPT_NODE_FLAGS"; @@ -123,8 +122,8 @@ public class TypeScriptParser { private String nodeJsRuntime; /** - * Arguments to pass to the Node.js runtime each time it is invoked. - * Initialised by {@link #verifyNodeInstallation}. + * Arguments to pass to the Node.js runtime each time it is invoked. Initialised by {@link + * #verifyNodeInstallation}. */ private List nodeJsRuntimeExtraArgs = Collections.emptyList(); @@ -139,7 +138,8 @@ public class TypeScriptParser { /** * Verifies that Node.js and TypeScript are installed and throws an exception otherwise. * - * @param verbose if true, log the Node.js executable path, version strings, and any additional arguments. + * @param verbose if true, log the Node.js executable path, version strings, and any additional + * arguments. */ public void verifyInstallation(boolean verbose) { verifyNodeInstallation(); @@ -158,7 +158,7 @@ public class TypeScriptParser { ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream err = new ByteArrayOutputStream(); - + // Determine where to find the Node.js runtime. String explicitNodeJsRuntime = Env.systemEnv().get(TYPESCRIPT_NODE_RUNTIME_VAR); if (explicitNodeJsRuntime != null) { @@ -175,7 +175,9 @@ public class TypeScriptParser { nodeJsRuntimeExtraArgs = Arrays.asList(extraArgs.split("\\s+")); } - Builder b = new Builder(getNodeJsRuntimeInvocation("--version"), out, err, getParserWrapper().getParentFile()); + Builder b = + new Builder( + getNodeJsRuntimeInvocation("--version"), out, err, getParserWrapper().getParentFile()); b.expectFailure(); // We want to do our own logging in case of an error. int timeout = Env.systemEnv().getInt(TYPESCRIPT_TIMEOUT_VAR, 10000); @@ -203,15 +205,14 @@ public class TypeScriptParser { } /** - * Gets a command line to invoke the Node.js runtime. - * Any arguments in {@link TypeScriptParser#nodeJsRuntimeExtraArgs} - * are passed first, followed by those in {@code args}. + * Gets a command line to invoke the Node.js runtime. Any arguments in {@link + * TypeScriptParser#nodeJsRuntimeExtraArgs} are passed first, followed by those in {@code args}. */ - private List getNodeJsRuntimeInvocation(String ...args) { + private List getNodeJsRuntimeInvocation(String... args) { List result = new ArrayList<>(); result.add(nodeJsRuntime); result.addAll(nodeJsRuntimeExtraArgs); - for(String arg : args) { + for (String arg : args) { result.add(arg); } return result; diff --git a/javascript/extractor/src/com/semmle/ts/ast/UnaryTypeExpr.java b/javascript/extractor/src/com/semmle/ts/ast/UnaryTypeExpr.java index 2f2619c6ece..67575a4fdca 100644 --- a/javascript/extractor/src/com/semmle/ts/ast/UnaryTypeExpr.java +++ b/javascript/extractor/src/com/semmle/ts/ast/UnaryTypeExpr.java @@ -6,7 +6,7 @@ import com.semmle.js.ast.Visitor; /** * A unary operator applied to a type. * - * This can be keyof T or readonly T. + *

    This can be keyof T or readonly T. */ public class UnaryTypeExpr extends TypeExpression { private final ITypeExpression elementType; diff --git a/javascript/extractor/src/com/semmle/ts/extractor/TypeExtractor.java b/javascript/extractor/src/com/semmle/ts/extractor/TypeExtractor.java index 8d1aae35681..ed9242490e9 100644 --- a/javascript/extractor/src/com/semmle/ts/extractor/TypeExtractor.java +++ b/javascript/extractor/src/com/semmle/ts/extractor/TypeExtractor.java @@ -4,7 +4,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import com.semmle.util.trap.TrapWriter; import com.semmle.util.trap.TrapWriter.Label; - import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List;